﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MyPublisher.Administration.ViewModels;

namespace MyPublisher.Administration
{
    class SplashHyperLink : Hyperlink
    {
        public string Form { get; set; }
        public string Action { get; set; }

        public SplashHyperLink(SplashItem splashItem)
        {
            Run run = new Run(splashItem.Name);
            this.Inlines.Add(run);
            this.Form = splashItem.Form;
            this.Action = splashItem.Action;
        }
    }

    public partial class SplashView : UserControl
    {
        public SplashView()
        {
            InitializeComponent();

            LoadItems();
        }

        public void LoadItems()
        {
            List<SplashItem> splashItems = new List<SplashItem>()
            {
                new SplashItem(){Action="F",Form="",IsVisible=true,Name="Documents"},
                new SplashItem(){Action="F",Form="",IsVisible=true,Name="Files"},
                new SplashItem(){Action="N",Form="",IsVisible=true,Name="Insert Document"},
                new SplashItem(){Action="N",Form="",IsVisible=true,Name="Insert File"}
            };
            foreach (SplashItem item in splashItems)
            {
                TextBlock tb = new TextBlock();
                tb.Inlines.Add(new SplashHyperLink(item));
                switch (item.Action)
                {
                    case "F":
                        this.openFormPanel.Children.Add(tb);
                        break;
                    case "N":
                        this.insertRecordPanel.Children.Add(tb);
                        break;
                    default:
                        this.otherFunPanel.Children.Add(tb);
                        break;
                }
            }
        }
    }
}
